package min.chapter.four;

import min.chapter.four.entrance.HomeController;
import min.chapter.four.entrance.InfraredRaySensor;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class EntranceAcquisition {

	public static void main(String[] args) {
		String[] configLocations = new String[] { "min/chapter/four/entrance/Entrance.xml" };
		AbstractApplicationContext context = new ClassPathXmlApplicationContext(
				configLocations);
		context.registerShutdownHook();
		HomeController homeControl = context.getBean("homeController",
				HomeController.class);
		homeControl.checkSensorAndAlarm();
		InfraredRaySensor doorSensor = context.getBean("doorSensor",
				InfraredRaySensor.class);
		doorSensor.foundObject();
		homeControl.showCameraImage();
		homeControl.checkSensorAndAlarm();
	}
}
